
struct3.o:     file format elf32-littlearm


Disassembly of section .text:

00000000 <print>:
}A;

A tmp = {10, '0'};

void print(void)
{
   0:	e92d4800 	push	{fp, lr}
   4:	e28db004 	add	fp, sp, #4
        printf("tmp.a = %d tmp.b = %c\n", tmp.a, tmp.b);	// tmp.a = 10 tmp.b = 0
   8:	e59f3040 	ldr	r3, [pc, #64]	; 50 <print+0x50>
   c:	e5931000 	ldr	r1, [r3]
  10:	e59f3038 	ldr	r3, [pc, #56]	; 50 <print+0x50>
  14:	e5d33004 	ldrb	r3, [r3, #4]
  18:	e1a02003 	mov	r2, r3
  1c:	e59f0030 	ldr	r0, [pc, #48]	; 54 <print+0x54>
  20:	ebfffffe 	bl	0 <printf>

        printf("&tmp = %p &tmp.a = %p &tmp.b = %p\n", 
  24:	e59f1024 	ldr	r1, [pc, #36]	; 50 <print+0x50>
  28:	e59f2020 	ldr	r2, [pc, #32]	; 50 <print+0x50>
  2c:	e59f3024 	ldr	r3, [pc, #36]	; 58 <print+0x58>
  30:	e59f0024 	ldr	r0, [pc, #36]	; 5c <print+0x5c>
  34:	ebfffffe 	bl	0 <printf>
                        (unsigned long)(void *)&tmp, 
                        (unsigned long)(void *)&tmp.a,
                        (unsigned long)(void *)&tmp.b);	// &tmp = 0x804995c &tmp.a = 0x804995c &tmp.b = 0x8049960

        printf("sizeof tmp = %d sizeof tmp.a = %d sizeof tmp.b = %d\n", 
  38:	e3a03001 	mov	r3, #1
  3c:	e3a02004 	mov	r2, #4
  40:	e3a01008 	mov	r1, #8
  44:	e59f0014 	ldr	r0, [pc, #20]	; 60 <print+0x60>
  48:	ebfffffe 	bl	0 <printf>
                        sizeof(A),
                        sizeof(int),
                        sizeof(char));	// sizeof tmp = 8 sizeof tmp.a = 4 sizeof tmp.b = 1;  A=8字节为为了结构体对齐
}
  4c:	e8bd8800 	pop	{fp, pc}
	...
  58:	00000004 	.word	0x00000004
  5c:	00000018 	.word	0x00000018
  60:	0000003c 	.word	0x0000003c

00000064 <priBit>:

void priBit(int t)
{
  64:	e92d4800 	push	{fp, lr}
  68:	e28db004 	add	fp, sp, #4
  6c:	e24dd010 	sub	sp, sp, #16
  70:	e50b0010 	str	r0, [fp, #-16]
        int i = 32;
  74:	e3a03020 	mov	r3, #32
  78:	e50b3008 	str	r3, [fp, #-8]

        printf("t = %d\n", t);
  7c:	e51b1010 	ldr	r1, [fp, #-16]
  80:	e59f0048 	ldr	r0, [pc, #72]	; d0 <priBit+0x6c>
  84:	ebfffffe 	bl	0 <printf>
        for (; i > 0; i--)
  88:	ea000009 	b	b4 <priBit+0x50>
        {
                printf("%d", (t >> i) & 0x0001);
  8c:	e51b2010 	ldr	r2, [fp, #-16]
  90:	e51b3008 	ldr	r3, [fp, #-8]
  94:	e1a03352 	asr	r3, r2, r3
  98:	e2033001 	and	r3, r3, #1
  9c:	e1a01003 	mov	r1, r3
  a0:	e59f002c 	ldr	r0, [pc, #44]	; d4 <priBit+0x70>
  a4:	ebfffffe 	bl	0 <printf>
void priBit(int t)
{
        int i = 32;

        printf("t = %d\n", t);
        for (; i > 0; i--)
  a8:	e51b3008 	ldr	r3, [fp, #-8]
  ac:	e2433001 	sub	r3, r3, #1
  b0:	e50b3008 	str	r3, [fp, #-8]
  b4:	e51b3008 	ldr	r3, [fp, #-8]
  b8:	e3530000 	cmp	r3, #0
  bc:	cafffff2 	bgt	8c <priBit+0x28>
        {
                printf("%d", (t >> i) & 0x0001);
        }
        printf("\n");
  c0:	e3a0000a 	mov	r0, #10
  c4:	ebfffffe 	bl	0 <putchar>
}
  c8:	e24bd004 	sub	sp, fp, #4
  cc:	e8bd8800 	pop	{fp, pc}
  d0:	00000074 	.word	0x00000074
  d4:	0000007c 	.word	0x0000007c

000000d8 <_main>:

int _main()
{
  d8:	e92d4800 	push	{fp, lr}
  dc:	e28db004 	add	fp, sp, #4
  e0:	e24dd008 	sub	sp, sp, #8
        int *p = NULL;
  e4:	e3a03000 	mov	r3, #0
  e8:	e50b3008 	str	r3, [fp, #-8]

        print();
  ec:	ebfffffe 	bl	0 <print>
        p = (int *)&tmp;
  f0:	e59f3030 	ldr	r3, [pc, #48]	; 128 <_main+0x50>
  f4:	e50b3008 	str	r3, [fp, #-8]
        priBit(*p);
  f8:	e51b3008 	ldr	r3, [fp, #-8]
  fc:	e5933000 	ldr	r3, [r3]
 100:	e1a00003 	mov	r0, r3
 104:	ebfffffe 	bl	64 <priBit>
        priBit(*(p + 1));	// 指向下一个字段;  48 = '0'
 108:	e51b3008 	ldr	r3, [fp, #-8]
 10c:	e2833004 	add	r3, r3, #4
 110:	e5933000 	ldr	r3, [r3]
 114:	e1a00003 	mov	r0, r3
 118:	ebfffffe 	bl	64 <priBit>
}
 11c:	e1a00003 	mov	r0, r3
 120:	e24bd004 	sub	sp, fp, #4
 124:	e8bd8800 	pop	{fp, pc}
 128:	00000000 	.word	0x00000000

0000012c <main>:
        char name[20];
        int num;
};

int main()
{
 12c:	e92d4800 	push	{fp, lr}
 130:	e28db004 	add	fp, sp, #4
 134:	e24dd020 	sub	sp, sp, #32
        void *p = NULL;
 138:	e3a03000 	mov	r3, #0
 13c:	e50b3008 	str	r3, [fp, #-8]
        struct stu a={"li main",5};
 140:	e59f3048 	ldr	r3, [pc, #72]	; 190 <main+0x64>
 144:	e24bc020 	sub	ip, fp, #32
 148:	e1a0e003 	mov	lr, r3
 14c:	e8be000f 	ldm	lr!, {r0, r1, r2, r3}
 150:	e8ac000f 	stmia	ip!, {r0, r1, r2, r3}
 154:	e89e0003 	ldm	lr, {r0, r1}
 158:	e88c0003 	stm	ip, {r0, r1}
        p=&a;
 15c:	e24b3020 	sub	r3, fp, #32
 160:	e50b3008 	str	r3, [fp, #-8]
        printf(" %s %d  \n",( (struct stu *) p )->name,( (struct stu *) p )->num);	// li main 5 
 164:	e51b1008 	ldr	r1, [fp, #-8]
 168:	e51b3008 	ldr	r3, [fp, #-8]
 16c:	e5933014 	ldr	r3, [r3, #20]
 170:	e1a02003 	mov	r2, r3
 174:	e59f0018 	ldr	r0, [pc, #24]	; 194 <main+0x68>
 178:	ebfffffe 	bl	0 <printf>

		_main();
 17c:	ebfffffe 	bl	d8 <_main>

		return 0;
 180:	e3a03000 	mov	r3, #0
}
 184:	e1a00003 	mov	r0, r3
 188:	e24bd004 	sub	sp, fp, #4
 18c:	e8bd8800 	pop	{fp, pc}
 190:	0000008c 	.word	0x0000008c
 194:	00000080 	.word	0x00000080
